using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAL;

namespace BUS
{
    public class AlbumBUS
    {
        public static void Insert(tbAlbum album)
        {
            AlbumDAL albumdal = new AlbumDAL();
            albumdal.Insert(album);
        }
        public static void Update(tbAlbum album)
        {
            AlbumDAL albumdal = new AlbumDAL();
            albumdal.Update(album);
        }
        public static void Delete(int iD)
        {
            AlbumDAL albumdal = new AlbumDAL();
            albumdal.Delete(iD);
        }
        public static tbAlbumcollection GET(string Where, int PageIndex, int PageSize,
                                        string OrderBy, string OrderDirection,
                                        out int TotalRecords)
        {
            AlbumDAL albumdal = new AlbumDAL();
            return albumdal.GET(Where, PageIndex, PageSize,
                            OrderBy, OrderDirection, out TotalRecords);
        }
        public static tbAlbum GetByID(int iD)
        {
            int t = 0;
            AlbumDAL albumdal = new AlbumDAL();
            tbAlbumcollection Albumcollection = albumdal.GET("where " + tbAlbumcolumn.idalbum.ToString() + " = " + iD.ToString(), 0, 0,
                tbAlbumcolumn.tenalbum.ToString(), "ASC", out t);
            if (Albumcollection.Count == 1)
                return Albumcollection[0];
            return null;
        }
        public static tbAlbumcollection GetAll()
        {
            int t = 0;
            AlbumDAL albumdal = new AlbumDAL();
            return albumdal.GET("where 1=1", 0, 10,
                tbAlbumcolumn.tenalbum.ToString(), "ASC", out t);
        }
    }
}
